package com.suxg.hbase.web;

import java.util.HashMap;
import java.util.Map;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;

import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ValiteController {
	@RequestMapping("/")
	public Map<String,String> hello(@Valid @NotBlank(message = "姓名不能为空") String user, BindingResult bindingResult){
		Map<String,String> map=new HashMap<>();
		String message="";
	if(bindingResult.hasErrors()){
	String  mesg= bindingResult.getFieldError().getDefaultMessage();
	map.put("code", "90000");
	map.put("message", mesg);
	return map;
	}
	
	map.put("code", "10000");
	map.put("message", "12312");
	return map;
 }
}